package routers

import (
	"geek-cloud-native/chapter04-0925/src/middleware"
	v1 "geek-cloud-native/chapter04-0925/src/routers/api/v1"
	"github.com/julienschmidt/httprouter"
)

func NewRouter() *httprouter.Router {
	r := httprouter.New()
	health := v1.NewHealthz()
	user := v1.NewUser()
	r.GET("/healthz", middleware.LoggerMiddleware(middleware.HeaderMiddleware(health.HealthCheck)))
	r.GET("/api/v1/users", middleware.LoggerMiddleware(middleware.HeaderMiddleware(user.List)))
	return r
}
